package util
{

	public class DateHelper
	{
		public static const MILLI_SECONDES_PRE_HOUR:int=1000 * 60 * 60;
		public static const MILLI_SECONDES_PRE_DAY:int=MILLI_SECONDES_PRE_HOUR * 24;

		public static function after(begin:Date, end:Date):Boolean
		{
			if(begin == null || end == null)
				return true;
			var beginDate:Date=new Date(begin.fullYear, begin.month, begin.date);
			var endDate:Date=new Date(end.fullYear, end.month, end.date);
			return endDate.time - beginDate.time >= 0;
		}

		public static function addDaysByDateTime(date:Date, addDay:Number):Date
		{
			return new Date(date.getTime() + MILLI_SECONDES_PRE_DAY * addDay);
		}

		public static function addHoursByDateTime(date:Date, addHour:Number):Date
		{
			return new Date(date.getTime() + MILLI_SECONDES_PRE_HOUR * addHour);
		}
	}
}
